package base;

import java.util.UUID;

/**
 * @Author DRevelation
 * @Date 2020-07-02 上午 10:44
 * @Desc
 */
public class UUIDDemo {
    public static void main(String[] args) {
        String uuid = UUID.randomUUID().toString();
        System.out.println(uuid);
        //通常会把生成的uuid里面的 '-' 去掉
        String uuid_ = uuid.replace("-", "");
        System.out.println(uuid_);

        System.out.println(changeObsUrl("http://obs.cn-north-4.myhuaweicloud.com/ahtv-obs-sobey/u-2x49025gw566w530/2020/12/16/390c05e805de4cac98dd12900707d2be_videogroup_eb8aa8c80c0b495183596a701.mp4"));

        String matUrl = "";
        String matName = matUrl.substring(matUrl.lastIndexOf("/") + 1);
    }

    private static String changeObsUrl(String url) {
//        OssFactory ossFactory = OssBuilder.builer();
        String srcBucketName = "ahtv-obs-sobey";
        String srcObjectName = url.substring(url.indexOf(srcBucketName) + srcBucketName.length() + 1);
        String destBucketName = "ahtv-obs";
        String destObjectName = srcObjectName;
//        ossFactory.copyObject(srcBucketName, srcObjectName, destBucketName, destObjectName);
        String newUrl = "http://obs.cn-north-4.myhuaweicloud.com/" + destBucketName + "/" + destObjectName;
        return newUrl;
    }
}
